#ifndef _USBCAP_
#define _USBCAP_

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <linux/videodev2.h>
#include <string.h>
#include <sys/mman.h>

class USBCAP
{
public:
    USBCAP();
    ~USBCAP();
    int Close();
    int USBCap_GetInfo(struct v4l2_capability  *CapInfo,\
                       struct v4l2_fmtdesc     *CapDesc,\
                       struct v4l2_frmsizeenum *CapFrmSize,\
                       struct v4l2_frmivalenum *frmival);
    int USBCap_NowInfo(struct v4l2_format      *CapFormat);
    int USBCap_SetInfo(struct v4l2_format      *CapFormat);
    int USBCap_ReqBuffer(int BufferNum);
    int USBCap_GetOneFrame(unsigned char** base,unsigned int* length);
public:
    int fd; 
    struct v4l2_requestbuffers ReqBuf;
    struct v4l2_buffer buffer;
    unsigned char *frm_base[3];
    unsigned int size[4];
};

#endif